﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="get_grammar.aspx.cs" Inherits="SQT.tracnghiem.Ajax.ASP.Lesson.get_grammar" %>

<%@ Import Namespace="DataAccess" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<body>
    <%
        int id = int.Parse(Request.QueryString["id"]);
        var get_grammar = from p in new TblLessonGrammarController().FetchAll().Where(x => x.LessonId == id && x.GramActive == true) orderby p.GramIndex ascending select p;
        foreach (TblLessonGrammar grammar in get_grammar)
        {
    %>
    <div id="grammar<%=grammar.GramId %>" class="w3-row w3-border w3-margin-bottom">
        <div class="w3-hide grammar_id"><%=grammar.GramId %></div>
        <header class="grammar-name w3-row w3-padding w3-indigo w3-large">
            <i class="muiten fa fa-chevron-down w3-right w3-padding-top"></i>
            <input type="text" value="<%=grammar.GramName %>" placeholder="Nhập tên ngữ pháp" class="w3-text-black w3-half edit_grammar_name" />
        </header>
        <div class="lesson-child-content w3-row w3-padding">
            <p>
                <label class="w3-border-bottom"><i class="fa fa-bookmark"></i>&nbsp;Cấu trúc</label>
            </p>
            <div class="w3-row w3-padding">
                <textarea rows="4" id="edit_grammar_structure<%=grammar.GramId %>" class="w3-half edit_grammar_structure" placeholder="Nhập cấu trúc"><%=grammar.GramStructure %></textarea>
            </div>
            <p>
                <label class="w3-border-bottom"><i class="fa fa-creative-commons"></i>&nbsp;Ý nghĩa</label>
            </p>
            <div class="w3-row w3-padding">
                <textarea rows="4" id="edit_grammar_mean<%=grammar.GramId %>" class="w3-half edit_grammar_mean" placeholder="Nhập ý nghĩa"><%=grammar.GramMean %></textarea>
            </div>
            <p>
                <label class="w3-border-bottom"><i class="fa fa-lightbulb-o"></i>&nbsp;Cách sử dụng</label>
            </p>
            <div class="w3-row w3-padding">
                <textarea rows="4" id="edit_grammar_use<%=grammar.GramId %>" class="w3-half edit_grammar_use" placeholder="Nhập cách sử dụng"><%=grammar.GramUse %></textarea>
            </div>
            <div class="w3-row">
                <label class="w3-border-bottom"><i class="fa fa-commenting-o"></i>&nbsp;Ví dụ</label><br />
                <a class="themvidu-btn w3-text-indigo"><i class="fa fa-plus"></i>&nbsp;Thêm ví dụ</a><br />
                <div class="themvidu w3-half w3-padding w3-border w3-border-indigo" style="display: none">
                    <div class="w3-row w3-margin-bottom"><span class="w3-col l2">Nội dung</span><input type="text" placeholder="Nhập nội dung ví dụ" class="w3-col l10 txt_grammar_example" /></div>
                    <div class="w3-row"><span class="w3-col l2">Vietsub</span><input type="text" placeholder="Nhập vietsub cho ví dụ" class="w3-col l10 txt_grammar_mean" /></div>
                    <div class="w3-padding"><span class="w3-col l2">&nbsp;</span><a class="w3-btn w3-indigo w3-small btn_add_grammar_example"><i class="fa fa-save"></i>&nbsp;Lưu</a></div>
                </div>
            </div>

            <div class="w3-row w3-padding">
                <div class="example_area">
                    <%
            int i = 1;
            foreach (TblLessonGrammarExample ex in new TblLessonGrammarExampleController().FetchAll().Where(x => x.GramId == grammar.GramId))
            {
                
                    %>
                    <p class="examp<%=ex.ExamId %>"><a class="w3-hide examp_mean"><%=ex.ExamTrans %></a><a class="w3-hide examp_id"><%=ex.ExamId %></a><a data-trigger="hover" data-toggle="popover" data-placement="bottom" data-content="<%=ex.ExamTrans %>" class="example-gram"><span class="number_grammar_example"><%=i %></span>) <span class="examp_content"><%=ex.ExamName %></span></a>&nbsp;<i class="suavidu-btn fa fa-pencil" title="Chỉnh sửa"></i>&nbsp;<i class="xoavidu-btn fa fa-trash" title="Xóa"></i></p>
                    <% i++;
            } %>
                </div>
                <div class="w3-row w3-center">
                    <a class="w3-btn w3-indigo btn_edit_grammar"><i class="fa fa-save"></i>&nbsp;Lưu chỉnh sửa</a>&nbsp;<a onclick="document.getElementById('xoanguphap').style.display = 'block';document.getElementById('del_grammar_id').innerHTML = '<%=grammar.GramId %>'" class="w3-btn w3-indigo"><i class="fa fa-trash"></i>&nbsp;Xóa ngữ pháp</a>
                </div>
            </div>
        </div>
    </div>
    <% } %>
</body>
</html>
